Set default CONFIG_BROADCAST_TABLE_SIZE - #728
Conversation
Zigbee PRO must have it set to 15 and if user like doing it different they can setting it in config
|
Sorry @puddly for pinging you in the morning !!! This is the right way if like hotting the broadcast with "extended firmware" it shall being done in config like: I running my IKEA controller test network with the config and its with the stock ZBT-2 firmware. |
|
@MattWestb Given zigpy/ziggurat#43 and zigpy/ziggurat#55, do you still think SiLabs default of 15 is right? Nobody really uses such a conservative config even for manufacturers using SiLabs chips, no? |
|
Its up to you but its depends of the users network if all routers is "extended" is it OK. Feel free do what you like / feel is the right for ZHA in the end = fixing or closing. As normal great work / digging done !! |
|
While I totally understand the concern behind the varying broadcast limits, I think the community feedback so far was that the higher broadcast table size actually helped them. In most cases, I think it's only really relevant for users manually dragging the color wheel slider in the HA UI. And there, you either get an error message really fast with the Should this turn out to be an actual issue, we could even add a settings toggle in the frontend which is like "Limit broadcast messages" with an explanation to use that when you have a busy network or congested airtime, perhaps (to reserve "airtime" for unicasts, even if a lot of broadcast commands are being transmitted). Grouped Hue lights testingI do have 11 Hue lights grouped in a garden I've just tested with and even spamming broadcast commands (dragging color wheel sends commands every 500 ms), everything seems to react just fine there. They're all not "directly connected" to the coordinator, most have Hue lights in between. Only when spamming them really hard after some time (rapidly clicking color wheel as fast as possible, so broadcast commands get sent every few millisecond) do I see So at that point, I do manage to hit the broadcast table size limit again. It also seems like some lights rarely do desynchronize when I really spam it. But I guess that's because the 64 limit is higher than the one Hue is using*. IMO, it's not a big issue though, as you have to hit it really hard to cause that. I think this is acceptable. (*: Limit for outgoing broadcasts would be 58 – the bot comment will have more on this. But even that number is likely still slightly higher than the Hue limit, though again, I don't think it's a big issue currently.) Right balanceOverall, I think this boils down to figuring out a good balance. That manufacturers already use higher broadcast limits than the default On this PRI'll have the bot write something as well here to see if there's extra information but I think the PR is not doing what you want it to do at the moment. Currently, this PR would always set a minimum of |
|
Some supporting detail for the points above — what the firmware on the common coordinators actually ships, and the numbers behind the "error quickly at 15, works much longer at higher values" difference. What the change does on real hardware
On the mainstream Home Assistant coordinators the gap is much wider, because their firmware does not use the SiLabs default at all. From the silabs-firmware-builder manifests at the current release,
This is not a recent change — the value is already 64 at So on a ZBT-2 this PR changes nothing: the value is already 64 and the write is skipped. Reassuringly, it also cannot clamp that 64 back down — One edge case where it is not a no-opIf What the table size controls on a coordinatorOrigination capacity is roughly the table size minus six — about 58 on a ZBT-2 at 64, about 9 if it were 15Since a ZBT-2 running bellows is only ever a coordinator, the operative day-to-day pressure is not how much it relays for others but how much it can originate. That is governed by #define BROADCAST_TABLE_SIZE sli_zigbee_broadcast_table_size
...
#define NEW_ENTRY_THRESHOLD (BROADCAST_TABLE_SIZE - 6)
That makes the table size the value governing how many broadcasts the host can send before the stack refuses to originate any more — SiLabs' own wording for the threshold is that "the local device will fail to originate a broadcast message after this threshold is reached". It is very likely why these coordinators ship 64. Those two figures are the difference described above, quantified: roughly 58 commands before a refusal at 64, against roughly 9 at 15. On current Simplicity SDK firmware the refusal arrives as a generic A "limit broadcast messages" option, if one were ever wanted, would sit naturally on this threshold rather than on the table size. Why the safe default is the larger value, not the smaller oneThe principle raised for this PR — that ZHA should be safe out of the box, and tuning should be opt-in — seems right to me. I think it argues for leaving these coordinators at 64. Consider what a user actually does to trigger this: dragging the colour wheel for a Zigbee group in the UI. The frontend throttles those updates to one command every 500 ms while the pointer is moving, so it is a sustained couple of commands per second for as long as the drag lasts — user-driven rather than steady state, and the scenario zigpy/ziggurat#43 is about. There are two ways it can go. With a small table, the first several commands go out and then the burst exhausts the coordinator's own origination budget. The drag stops taking effect partway through, the remaining commands are never transmitted, and it surfaces as delivery errors in the log. With a larger table they keep flowing, and the remaining risk is that individual routers drop some of them. Per the firmware survey in zigpy/ziggurat#55 most routers in a typical network run 40–56, so that is uncommon, and the capture in that PR found routers still relaying through a sustained burst. Both end the same way for the user when they go wrong — the light stops following the wheel — but only the second lets the network try. Refusing early does save airtime, since the refused frames are never sent. What it does not do is protect neighbours' tables: a 15-entry router admits roughly nine per window and drops the rest whether the coordinator offered nine or fifty-eight, so a size mismatch costs airtime rather than peer table space. And a coordinator that goes quiet does not save even that cleanly, for the passive-acknowledgement reason below. That is why a lower value does not read as the safer default here: for a coordinator it makes the failure certain rather than unlikely. The conditional raised earlier in this thread — that it depends whether the routers in the network are extended — is the right test, and the survey in zigpy/ziggurat#55 is the answer to it: for networks built from the common router brands, they largely are. Where that leaves the PRSince the write is skipped on every current coordinator, nothing here changes behaviour as it stands, so closing seems reasonable. Two things worth keeping out of it either way. The other half of the suggestion — documenting the override rather than only changing the default — seems worth doing independently of what happens to this PR, and it may already cover the concern here. A user-supplied zha:
zigpy_config:
ezsp_config:
CONFIG_BROADCAST_TABLE_SIZE: 15which bellows will send as-is rather than treating it as a minimum. Lowering does take effect on the NCP; raising is rejected outright by the firmware rather than clamped, so on a ZBT-2 the real ceiling is its built-in 64 and a config line asking for 254 simply fails. That the stock coordinator firmware already ships 64 is probably the most useful thing for such a page to say. Why lowering takes effect and raising cannotThe stack's broadcast logic reads the table size from a runtime variable rather than the compile-time constant — The same pairing puts Raising is the direction that cannot work, and the firmware is explicit about it: for these entries the handler compares the requested value against the current one and returns an error rather than storing, so a request above the compiled size fails instead of being clamped. That fits the memory layout — the table is a statically allocated array sized by the compile-time constant, with nothing behind a larger runtime value. One consequence worth knowing if this gets documented: within a single NCP session the value can only ever go down, so recovering a lowered value takes an adapter reset, after which the firmware default applies again. And if a broadcast table entry is ever added for some other reason, the Background, alternatives and caveatsNone of the above depends on these — they are the working behind it, the alternative I considered and rejected, and the places where the concern in this PR does hold. On "Zigbee PRO must have it set to 15"SiLabs' own comment next to the default says otherwise: /* The minimum broadcast table size per the Zigbee Pro spec is 9. */
#define SL_ZIGBEE_DEFAULT_BROADCAST_TABLE_SIZE 15The configurable range is 15–254. R23.2 itself does not specify a broadcast table size; The same header goes further, and is worth reading alongside the stack comparison in zigpy/ziggurat#43. SiLabs describe 15 not as a spec value but as their own compensation for departing from one:
So 15 is the number that exists because their entry timeout departs from the spec — a compensation for holding entries 15–20 s instead of 9 s, sized to land at the same bandwidth. Reading it as a floor the spec imposes gets it backwards. The burst clamp layered on top has no spec counterpart at all: the same header describes it as approximating "the behavior of the pre-z3.1 stack", which is backwards compatibility rather than conformance. R23.2 section 3.6.6 asks only that a device track each broadcast, drop new ones when the table is full, and expire entries after the delivery time — it sets no table size, no rate, and no burst limit. That is the point the comparison in zigpy/ziggurat#43 makes across stacks, and it puts SiLabs at 15 at the conservative end of the group rather than at the reference point. Why not drop
|
Zigbee PRO must have it set to 15 and if user like doing it different they can setting it in config on there own risk braking broadcast in the mesh network (if using star network its not a problem)